home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
PBLIB1
/
PROGS
/
TPRINT.DOC
< prev
next >
Wrap
Text File
|
1994-01-05
|
9KB
|
252 lines
\space 20
\CENTER on
TPRINT PROGRAM DOCUMENTATION
(and test file)
\space 20
\CENTER off
Howard Richoux
6721 Shamrock Rd.
Lincoln, NE 68506-2821
(402) 488-5867
\HEADER1 '@LABEL1|@FILE|Page @PAGE'
\header2 ' '
\new
\CENTER TPRINT 3.00
\join
This program is an old-fashioned, command based text
processor. Formatting commands are placed in the clear in the
text file, rather than hidden as invisible character sequences.
One of the benefits is that you can see exactly what formatting is
going to be done. Also, it is pretty easy to generate some of these
commands programatically, in report programs, and use the output for
multiple purposes.
Please examine the source for this documentation print-out
because I am trying to exercise as many aspects of the program as
possible. Also, some of the functions were added to TPRINT simply to
exercise various parts of the code library. The BOX drawing stuff
on the next page isn't really useful, but it needed exercise.
\join off
Commands:
\indent 10
OFFSET n - left margin for everything ( 0 - 20 )
INDENT n - Sets an additional offset for text ( 0 - 20 )
CENTER ON/OFF - Centers all lines from ON to OFF
CENTER text - Centers this text
SPACE n - Writes n blank lines
NEW - Goes to new page
TRIGGER n - n is the decimal equivalent of an ASCII char
default is backslash (92)
\indent 0
Headers and Footers:
\indent 10
HEADERn 'spec' - Sets a new header specification (details later)
FOOTERn 'spec' - Sets a new footer specification (details later)
\indent 0
Special Commands: (Debugging)
\indent 10
DEBUG ON/OFF - Sets a flag for program to print intermediate steps
ECHO ON/OFF - Echoes the TPRINT commands encountered
\indent 0
\join
These are typically set in a TPRINT.CFG file. There are (optionally)
two of these files. The first resides on the same directory as the
TPRINT.EXE file. This would be used to hold general defaults, which
will apply to all uses of the program. These can be overridden by a
TPRINT.CFG on the current directory. Even these can be overridden by
placing the same thing on the command line following the file name. This
same nested configuration file applies to most utilities I write. It
costs 5-10k in code size, but the added flexibility is extremely useful.
Because of the way it is implemented, you could duplicate TPRINT.exe as
TPRINT2.exe(or xyz.exe), change parameters in the TPRINT2.cfg files and have
a very different program.
\HEADER1 '@LABEL1|Quoted Strings Section|Page @PAGE'
\NEW
\CENTER TPRINT Headers and Footers
With any kind of luck, the header at the top of the page had
the center portion replaced. The specification for the top page header
was:
HEADER1 '@LABEL1|Quoted Strings Section|Page @PAGE'
Pages are laid out as follows:
Default Specification
HEADER1 '@LABEL1|@FILE|'
HEADER2 ' '
HEADER3 ''
<text>
FOOTER2 ''
FOOTER1 '||Page @PAGE'
A specification is of the form: '<spec>|<spec>|<spec3>' where
the specs define the left, center and right portions respectively. The
left section is left justified, the right section is right justified, and
the center section is centered, the '|' are invisible. These vary by the
defined page width.
The currently defined elements for headers and footers are as
follows:
\JOIN OFF
\INDENT 10
@DATE - current date as mm/dd/yy
@TIME - current time as hh:mm
@DTIME - date and time as mm/dd/yy hh:mm
@PAGE - current page number
@PROGID - program ID of program making listing
@FILE - current file being operated on
@LABEL1 - TPRINT defines as datetime of current file
@LABEL2 - undefined - set with param
@LABEL3 - undefined - set with param
Anything else is treated as literal characters and printed in the
appropriate place.
\INDENT 0
\JOIN ON
This group of variables is not random and is implemented in the
OUT_object level 1. Any program using the level 1 OUT_object can use these.
It is simple to add other variables, but since this is a rather low level
in the program, code added to the list object will propagate to most other
programs using the object. The DOS unit code added to the OUT_object was the
reason that the @FDATE variable (date time of current file) was removed from
the OUT_object and added to the TPRINT program. Similarly, the OUT_object was
divided into 2 levels to save about 5k of code for programs not needing headers,
footers, word-wrap and the like. Both levels provide the basic interchangeability
between console, printer and text file.
\HEADER1 '@LABEL1|@FILE|'
\HEADER2 ' '
\NEW
The JOIN command initiates a word-wrap function until turned off.
this ignores the end of lines in the source text, and wraps the text at
blank spaces in the words.
This isn't perfect, but allows some page formatting.
Blocks are terminated at a blank line. Here is the same text re-done with
a JOIN 40 (and an INDENT 10) to make a 40 char wide column.
\INDENT 10
\JOIN 40
The JOIN command initiates a word-wrap function until turned off.
this ignores the end of lines in the source text, and wraps the text at
blank spaces in the words.
This isn't perfect, but allows some page formatting.
Blocks are terminated at a blank line. Here is the same text re-done with
a JOIN 40 to make a 40 char wide column.
\JOIN
\INDENT 0
You will notice that JOINing is not a very sophisticated word
wrapping, it just backs off to the blank prior to overflowing the
set width. The above section set at a width of 40 averages about
35 characters per line, because the 5 or 6 character word has to
be pushed down to the next line. The full page width join is a little
more effective.
\NEW
\center Sourcing Other Text Files
\JOIN
The SOURCE command allows a second level of files to be read and
merged into a single document. At present, only 2 levels are allowed, so
SOURCE commands in sourced in files are ignored.
You can also SOURCE sections of a text file. A section is defined (for
other programs as well) as a portion of a text file beginning with
a string (starting at col 1) I will call a section tag (secttag in code)
such as: "\SECTION" or "?sect". The compiled in default is "{SECTION"
and this can be overrridden using the parameter SECTTAG='xx...xx' in the
various CFG files or command line. The next portion of the section line
is treated as a section name, and needs to be followed by at least one blank
to be recognized. The section ends at the next section tag or at the
end of file. Note: the sourced text will start on a new line.
Here is source from another file (\source tprint1.doc):
\join off
\source tprint1.doc
Back to tprint.doc
Now, just one section (\source tprint1.doc(two) ):
\source tprint1.doc(two)
Back to tprint.doc
\JOIN OFF
\INDENT 0
\NEW
\CENTER TPRINT Box Commands
This is a reasonable, though not too elegant, method of adding
line drawing commands to your text. The trigger character is the <tilde>
ASCII 126. You use them like quote marks to bracket characters you want
converted to line draw characters. Since TPRINT is printing this document,
I will replace the <tilde>s on this page with <hat>s (^).
This:
\JOIN OFF
\INDENT 10
This is a Box
Everything ^L---------M-------R^ Mnemonics:
outside ^| | |^ L = Upper Left
the ^| | |^ M = Upper Middle
squiggles ^| | |^ R = Upper Right
is normal ^S---------+-------s^ S = Left Side
text. ^| | |^ + = center
^| | |^ s = right side
^| | |^ l = lower left
^l---------m-------r^ m = lover middle
r = lower right
^1222222222222222223^
\INDENT 0
Becomes:
\INDENT 10
This is a Box
Everything ~L---------M-------R~ Mnemonics:
outside ~| | |~ L = Upper Left
the ~| | |~ M = Upper Middle
squiggles ~| | |~ R = Upper Right
is normal ~S---------+-------s~ S = Left Side
text. ~| | |~ + = center
~| | |~ s = right side
~| | |~ l = lower left
~l---------m-------r~ m = lover middle
r = lower right
~1222222222222222223~
The digits provide some of the other characters:
^1234567890^
becomes ~1234567890~
Hmmm... I guess I didn't implement them the way I thought, ... better go
back and see.
\INDENT 0
THE END